<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddFieldToSettingDocument extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('setting_documents', function (Blueprint $table) {
            $table->unsignedTinyInteger('is_use_url')->default(0)->comment('是否启用url,1启用0不启用')->after('document_content');
            $table->string('url_set')->default('')->comment('点击的url设置')->after('document_content');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        if(Schema::hasTable('setting_documents')){
            Schema::table('setting_documents', function (Blueprint $table) {
                $table->dropColumn('is_use_url');
                $table->dropColumn('url_set');
            });
        }
    }
}
